module lang::ofg::ast::FlowLanguage

data Program = program(set[Decl] decls, set[Stm] statements);

public loc emptyId = |id:///|;

// See section 2.1 Abstract Language (page 23) of the book on Reverse Engineering.

// OFG language abstract syntax, declarations:
// D ::= attribute
//    |  method(param_1, ..., param_k)
//    |  class-constructor(param_1, ..., param_k)
data Decl 
	= attribute(loc id)
	| method(loc id, list[loc] formalParameters)
	| constructor(loc id, list[loc] formalParameters)
	;
	
// OFG language abstract syntax, statements:
// S ::= program_location_x = new classname(param_1, ..., param_k)
//    |  program_location_x = program_location_y
//    |  [program_location_x =] program_location_y.method(param_1, ..., param_k)
data Stm
	= newAssign(loc target, loc class, loc ctor, list[loc] actualParameters)
	| assign(loc target, loc cast, loc source)
	| call(loc target, loc cast, loc receiver, loc method, list[loc] actualParameters)
	;
